package com.example.demo.util;


import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfPageEventHelper;
import com.lowagie.text.pdf.PdfWriter;

/**
 * Created by zhanglei on 2024/3/16.
 */
public class OpenPdfPageEventHelper extends PdfPageEventHelper {

    /**
     * 每开始一页pdf时回调
     *
     * @param pdfWriter
     * @param document
     */
    @Override
    public void onStartPage(PdfWriter pdfWriter, Document document) {
        try {
            // 生成页码
            OpenPdfUtil.addPageNum(pdfWriter, document);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
